<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <script>
      var year=prompt("请输入年份")
      var age =2022-parseInt(year)
      alert(age)
  </script>
</head>
<body>

</body>
</html>